<?php
require_once 'const/RequestConst.php';
?>

<div id="reginfo">
    <script language="javascript">
        function checkdata() {
            var error = false;
            var form_reg = document.form_reg;
            setMsgDiv('note-username', '');
            if(form_reg.username.value == '') {
                setMsgDiv('note-username', '您忘了填称呼！');
                error = true;
            }
            setMsgDiv('note-email', '');
            if(form_reg.email.value == '') {
                setMsgDiv('note-email', '您忘了填email！');
                error = true;
            }
            if(form_reg.email.value != form_reg.reemail.value) {
                setMsgDiv('note-email', '两次填入的email不相等！');
                error = true;
            }
            if(form_reg.email.value != '') {
                var patrn=/^(.+?)@([a-z0-9\.]+)\.([a-z]){2,5}$/i;
                if (!patrn.exec(form_reg.email.value)) {
                    setMsgDiv('note-email', '填入的email不正确！');
                    error = true;
                }
            }
            setMsgDiv('note-password', '');
            if(form_reg.password.value == '') {
                setMsgDiv('note-password', '您忘了填密码！');
                error = true;
            }
            if(form_reg.password.value != form_reg.repassword.value) {
                setMsgDiv('note-password', '两次填入的密码不相等！');
                error = true;
            }
            setMsgDiv('note-phone', '');
            if(form_reg.phone.value == '') {
                setMsgDiv('note-phone', '您忘了填电话！');
                error = true;
            }
            if(form_reg.phone.value != '') {
                var patrn=/^([0-9\-\.\s\(\)]+){5,22}$/i;
                if (!patrn.exec(form_reg.phone.value)) {
                    setMsgDiv('note-phone','填入的联系电话不正确！');
                    error = true;
                }
            }

            setMsgDiv('note-address', '');
            if(form_reg.address.value == '') {
                setMsgDiv('note-address', '您忘了填邮寄地址！');
                error = true;
            }
            if(error) {
                return false;
            }
        }

    </script>
    <form name="form_reg" action="/account/doregister" method="post" onsubmit="return checkdata()">
        <div id="user_info">帐号资料 * </div>
        <div>
            <div id="retinput">* 填写您的Email：</div>
            <div><input name="<?php echo P_EMAIL ?>" class="f" id="email" size="25" maxlength="50" />（同时作为会员登录使用）</div>
            <div class="clear"></div>
            <div id="retinput">* 再次输入的您Email：</div>
            <div><input name="reemail" id="reemail" size="25" maxlength="50" /></div>
            <div id="note-email"></div>
            <div class="clear"></div>
        </div>
        <div>
            <div id="retinput">* 输入您的登录密码：</div>
            <div> <input name="<?php echo P_PASSWORD ?>" type="password" id="password" size="25" maxlength="50" />
            </div>
            <div class="clear"></div>
            <div id="retinput">* 再次输入您的登录密码：</div>
            <div><input name="repassword" type="password" id="repassword" size="25" maxlength="50" />
            </div>
            <div id="note-password"></div>
            <div class="clear"></div>
        </div>
        <div id="user_info">联系资料 *</div>
        <div>
            <div id="retinput">* 填写姓名：</div>
            <div><input name="<?php echo P_NAME ?>" class="f" id="username" size="25" maxlength="50" /></div>
            <div id="note-username"></div>
            <div class="clear"></div>
        </div>
        <div>
            <div id="retinput">* 输入您的联系电话：</div>
            <div><input name="<?php echo P_PHONE ?>" class="f" id="phone" size="25" maxlength="50" /></div>
            <div id="note-phone"></div>
            <div class="clear"></div>
        </div>
        <div>
            <div id="retinput">* 输入您的邮寄地址：</div>
            <div><input name="<?php echo P_ADDRESS ?>" class="f" id="address" size="25" maxlength="50" /></div>
            <div id="note-address"></div>
            <div class="clear"></div>
        </div>

        <div class="clear"></div>
        <div id="user_info"></div>
        <div>
            <div>
                <input value="清空重填" type="reset" />
                <input name="" type="submit" value="确定提交" />
            </div>
        </div>
        <div class="clear"></div>
        <div id="reg_condition"></div>
    </form>
</div>